"""
@author: tk
@file: 习题8~10.py
@time: 2022/11/16 14:37
"""
# 8、日期处理
#       将时间格式为“30/06/2022 10-30”这种格式的日期字符串转化为“2022-06-30 10:30”
str1 = "30/06/2022 10-30"
str2 = str1[6:10]+"-"+str1[3:5]+"-"+str1[0:2]+" "+str1[11:13]+":"+str1[14:16]
print(str2)
# 9、按要求分别输入 年 、月、日 判断这是这一年中的多少天
lst=[31,28,31,30,31]
year = int(input("请输入年份:"))
month = int(input("请输入月份:"))
day = int(input("请输入日:"))
count = 0
if month == 1:
    count = day
elif month == 2:
    count = 31 + day
elif month == 3 and ((year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)):
    if month == 3:
        count = 31 + 29 + day
    if month == 4:
        count = 31 + 29 + 31 + day
    if month == 5:
        count = 31 + 29 + 31 + 30 + day
    if month == 6:
        count = 31 + 29 + 31 + 30 + 31 + day
    if month == 7:
        count = 31 + 29 + 31 + 30 + 31 + 30 + day
    if month == 8:
        count = 31 + 29 + 31 + 30 + 31 + 30 + 31 + day
    if month == 9:
        count = 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + day
    if month == 10:
        count = 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + day
    if month == 11:
        count = 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + day
    if month == 12:
        count = 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + day
else:
    if month == 3:
        count = 31 + 28 + day
    if month == 4:
        count = 31 + 28 + 31 + day
    if month == 5:
        count = 31 + 28 + 31 + 30 + day
    if month == 6:
        count = 31 + 28 + 31 + 30 + 31 + day
    if month == 7:
        count = 31 + 28 + 31 + 30 + 31 + 30 + day
    if month == 8:
        count = 31 + 28 + 31 + 30 + 31 + 30 + 31 + day
    if month == 9:
        count = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + day
    if month == 10:
        count = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + day
    if month == 11:
        count = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + day
    if month == 12:
        count = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + day

print("这是第%d天" % count)

# 10、输入一行字符串，分别统计其中英文字母、数字、以及其他字符的个数
x = input("请输入一串随机的字符串:")
num = 0
strn = 0
sym = 0
for i in x:
    if i.isnumeric():
        num += 1
    elif i.isalpha():
        strn += 1
    else:
        sym += 1

print("英文字母有:", strn, "个")
print("数字有:", num, "个")
print("其他字符有:", sym, "个")